package com.bestv.xml.parser;

import com.bestv.database.vo.IncrProgram;

import java.io.File;
import java.util.Map;

/**
 * Created by Henry on 14-7-9.
 */
public class ProgramParser extends Parser {
    public ProgramParser() {
        xpathExpression = "//Objects/Object[@ElementType='Program']";
    }

    public IncrProgram parse(File file) {
        Map<String, String> map = toMap(file);
        if (map == null) return null;

        IncrProgram program = new IncrProgram();
        program.setMediaCode(map.get("Code"));
        program.setName(map.get("Name"));
        program.setSeriesCode(map.get("SeriesCode"));
        return program;
    }
}
